package com.sdry.approval.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sdry.approval.entity.MeSponsor;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface MeSponsorMapper extends BaseMapper<MeSponsor> {

    /**
     * 改状态
     * @param requestType
     * @param requestId
     * @param status
     * @return
     */
    @Update("update me_sponsor set complete_status = #{status} where request_id = #{requestId} and me_sponsor_type = #{requestType}")
    Integer updateMeSponor(@Param("requestType") String requestType, @Param("requestId") Long requestId, @Param("status") String status);

    /**
     * 查询所有的
     * @return
     */
    @Select("select me_sponsor_id,me_sponsor_type,create_date,complete_status , le.user_id ,request_id from me_sponsor sp LEFT JOIN leave_man le on sp.request_id = le.leave_requert_id where le.type = 'cs' and complete_status = 'tg'")
    List<MeSponsor> queryCopySponsorPage();
}
